import { Column, Entity, Index } from "typeorm";
import { DeletedEntity } from "./base/deleted.entity";

@Index("sys_user_pkey", ["id"], { unique: true })
@Index("sys_user_username_not_deleted_ukey", ["username"], { unique: true })
@Entity("sys_user", { schema: "public" })
export class SysUser extends DeletedEntity {
    @Column("bigint", { primary: true, name: "id" })
    id!: string;

    @Column("character varying", { name: "username", length: 32 })
    username!: string;

    @Column("character varying", { name: "password", length: 128 })
    password!: string;

    @Column("character varying", { name: "nickname", length: 32, default: () => "'系统用户'" })
    nickname!: string;

    @Column("character varying", { name: "phone", length: 32, nullable: true })
    phone!: string;

    @Column("character varying", { name: "sex", length: 16 })
    sex!: string;

    @Column("character varying", { name: "avatar", nullable: true, length: 256 })
    avatar!: string | null;

    @Column("boolean", { name: "status", default: () => "true" })
    status!: boolean;

    @Column("bigint", { name: "dept_id", nullable: true })
    deptId!: string | null;
}
